package com.zhi.service.impl;

import com.zhi.dao.MaxValueRepository;
import com.zhi.entity.MaxValue;
import com.zhi.service.MaxValueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MaxValueServiceImpl implements MaxValueService {
	
	@Autowired
	private MaxValueRepository maxValueRepository;


	@Override
	public Integer getMax(String code) {
		return maxValueRepository.getMax(code);
	}

	@Override
	public void save(MaxValue maxValue) {
		maxValueRepository.save(maxValue);
	}

	@Override
	public void saveCodeAndValue(String code, Integer value) {
		MaxValue maxValue = new MaxValue(code,value);
		maxValueRepository.save(maxValue);
	}

}
